1
کامپیوتر و شبکه::
نوع نگهدارنده
In the above example, the generic class MyGenericClass defines a placeholder for the type, but the placeholder is like a black box, because MyGenericClass doesn't know anything about the placeholder type, whether it is primitive or non-primitive type, or an interface or custom class etc.
C# includes Constraints to specify which type of placeholder type with the generic class is allowed.
It will give a compile time error if you try to instantiate a generic class using a placeholder type that is not allowed by a constraints.
This means that only a class can be a placeholder type not the primitive types, struct etc.
So now, you cannot use int as a placeholder type.
واژگان شبکه مترجمین ایران